import axios from '../../plugins/axios/index'
import Vuex from '../../store/index'
import router from '../../router'
export default {
  // 用户登入
  login (access) {
    axios.request({
      url: 'api/home/authorization/login',
      method: 'post',
      data: access
    }).then(result => {
      // 设置全局的用户状态
      Vuex.commit('setUser', result.data)
      Vuex.commit('setIsLogin', true)
      router.push({ name: 'home' })
    })
  }
}
